home *** CD-ROM | disk | FTP | other *** search
/ Diccionario Visual Trilingue / VISUAL.iso / SHARED.DIR / 10094_Init Index.ls < prev    next >
Encoding:
Text File  |  1997-07-04  |  13.9 KB  |  438 lines

  1. global gTextLanguage, gHighLightPos, gCurrentPos, gNbItem, gCurrentField, gTermObj, gIndexPicObj, gScreenStatus, gReturnDialog, gSelection, gIndexChange, gIdxTermObj, gRealTextLanguage, gLabelLang
  2.  
  3. on ShowIndex langueTemp
  4.   global gPrgKey
  5.   if gPrgKey = 8 then
  6.     set gPrgKey to gPrgKey + 1
  7.   else
  8.     set gPrgKey to -10
  9.   end if
  10.   set LstSpriteVisible to [1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
  11.   watchCursor()
  12.   if (gScreenStatus = #ILLUSTRATION) or (gScreenStatus = #REGION) or (gScreenStatus = #ZOOM) then
  13.     FlushAllAnimationsData()
  14.     ResetActiveLabels()
  15.     ResetScreenLists()
  16.     EraseAll()
  17.   end if
  18.   set gReturnDialog to gScreenStatus
  19.   GrabStage()
  20.   addRAMobjects(#CastList, [10095, 10096, 10097, 10098, 10526, 10527, 10528, 10530, 10531, 10532, 10533, 10534, 10539, 10541, 10542, 10543, 10545, 10546, 10549, 10550, 10551, 10552, 10553, 10554, 10555])
  21.   if gIndexChange then
  22.     put " " into field 10096
  23.     put " " into field 10097
  24.     put " " into field 10098
  25.     set gHighLightPos to [0, 0, 0]
  26.     setAt(LstSpriteVisible, 9, 1)
  27.   else
  28.     if (gCurrentField > 0) and (gCurrentField < 4) then
  29.       setAt(LstSpriteVisible, ((gCurrentField - 1) * 7) + 9, 1)
  30.     end if
  31.   end if
  32.   repeat with i = 1 to 46
  33.     set the visible of sprite i to getAt(LstSpriteVisible, i)
  34.     set the cursor of sprite i to 0
  35.   end repeat
  36.   if not voidp(langueTemp) and (gTextLanguage <> langueTemp) then
  37.     set gRealTextLanguage to gTextLanguage
  38.     set gTextLanguage to langueTemp
  39.   else
  40.     set gRealTextLanguage to 0
  41.   end if
  42.   UpdateLabel()
  43.   InitializeFiles()
  44.   if the text of field 10095 = EMPTY then
  45.     set the text of field 10095 to " "
  46.   end if
  47.   set the textFont of field 10095 to "IVD10"
  48.   set the textSize of field 10095 to 10
  49.   if gCurrentField <> 6 then
  50.     set the foreColor of cast 10095 to 14
  51.     set the backColor of cast 10095 to 199
  52.   else
  53.     set the foreColor of cast 10095 to 255
  54.     set the backColor of cast 10095 to 0
  55.   end if
  56.   set the textSize of field 10096 to 10
  57.   set the textHeight of field 10096 to 12
  58.   set the textSize of field 10097 to 10
  59.   set the textHeight of field 10097 to 12
  60.   set the textSize of field 10098 to 10
  61.   set the textHeight of field 10098 to 12
  62.   set the locV of sprite 1 to 800
  63.   puppetTransition(9, 0, 5)
  64.   gotoframe(15)
  65.   set gScreenStatus to #Index
  66.   puppetTransition(0)
  67.   if gIndexChange = 0 then
  68.     set theLine to getAt(gHighLightPos, 1) - getAt(gCurrentPos, 1)
  69.     if (theLine >= 0) and (theLine < 6) then
  70.       set the locV of sprite 11 to ((getAt(gHighLightPos, 1) - getAt(gCurrentPos, 1)) * 12) + SpriteTop(10) + 1
  71.       set the visible of sprite 11 to 1
  72.     end if
  73.     set theLine to getAt(gHighLightPos, 2) - getAt(gCurrentPos, 2)
  74.     if (theLine >= 0) and (theLine < 6) and (gIndexChange = 0) then
  75.       set the locV of sprite 18 to ((getAt(gHighLightPos, 2) - getAt(gCurrentPos, 2)) * 12) + SpriteTop(17) + 1
  76.       set the visible of sprite 18 to 1
  77.     end if
  78.     set theLine to getAt(gHighLightPos, 3) - getAt(gCurrentPos, 3)
  79.     if (theLine >= 0) and (theLine < 6) and (gIndexChange = 0) then
  80.       set the locV of sprite 25 to ((getAt(gHighLightPos, 3) - getAt(gCurrentPos, 3)) * 12) + SpriteTop(24) + 1
  81.       set the visible of sprite 25 to 1
  82.       SpriteHandCursor(4)
  83.     end if
  84.     UpdateCursor(1, getAt(gCurrentPos, 1))
  85.     UpdateCursor(2, getAt(gCurrentPos, 2))
  86.     UpdateCursor(3, getAt(gCurrentPos, 3))
  87.   end if
  88.   set the castNum of sprite 6 to 10001
  89.   set the castNum of sprite 7 to 10001
  90.   set the height of sprite 10 to 72
  91.   set the height of sprite 17 to 72
  92.   set the height of sprite 24 to 72
  93.   set the stretch of sprite 11 to 1
  94.   set the height of sprite 11 to 12
  95.   set the width of sprite 11 to the width of sprite 10
  96.   set the locH of sprite 11 to getAt(the rect of sprite 10, 1)
  97.   set the stretch of sprite 18 to 1
  98.   set the height of sprite 18 to 12
  99.   set the width of sprite 18 to the width of sprite 17
  100.   set the locH of sprite 18 to getAt(the rect of sprite 17, 1)
  101.   set the stretch of sprite 25 to 1
  102.   set the height of sprite 25 to 12
  103.   set the width of sprite 25 to the width of sprite 24
  104.   set the locH of sprite 25 to getAt(the rect of sprite 24, 1)
  105.   SpriteHandCursor(3)
  106.   SpriteHandCursor(34)
  107.   updateStage()
  108.   if gCurrentField = 0 then
  109.     set the editableText of sprite 5 to 1
  110.     ActiveField(6)
  111.   else
  112.     ActiveField(gCurrentField)
  113.   end if
  114.   if gSelection <> EMPTY then
  115.     if charToNum(chars(gSelection, 2, 2)) = 39 then
  116.       set gSelection to chars(gSelection, 3, length(gSelection))
  117.     end if
  118.     set gHighLightPos to [1, 0, 0]
  119.     set Temp1 to FindWordPos(gSelection)
  120.     if Temp1 > 49999 then
  121.       set Temp1 to Temp1 - 50000
  122.     end if
  123.     setAt(gHighLightPos, 1, Temp1)
  124.     set gSelection to EMPTY
  125.   end if
  126.   if gIndexChange = 1 then
  127.     ActiveField(1)
  128.     set gIndexChange to 0
  129.     if getAt(gHighLightPos, 1) > 0 then
  130.       SetWindow1(1, 2)
  131.       set the text of cast 10095 to FindWordP(getAt(gHighLightPos, 1), 0)
  132.       FindTerms(getAt(gHighLightPos, 1))
  133.       if getAt(gHighLightPos, 2) > 0 then
  134.         SetWindow1(2, 2)
  135.         FindPics(getAt(gHighLightPos, 2))
  136.         if getAt(gHighLightPos, 3) > 0 then
  137.           SetWindow1(3, 2)
  138.         else
  139.           set the visible of sprite 4 to 0
  140.           ActiveButton(1)
  141.           SetWindow1(3, 1)
  142.         end if
  143.       else
  144.         put " " into field 10098
  145.         ActiveButton(1)
  146.         setAt(gCurrentPos, 2, 1)
  147.         SetWindow1(2, 3)
  148.         set the visible of sprite 25 to 0
  149.       end if
  150.     else
  151.       set the text of cast 10095 to EMPTY
  152.       put " " into field 10097
  153.       put " " into field 10098
  154.       ActiveButton(1)
  155.       SetWindow1(1, 3)
  156.     end if
  157.   else
  158.     if getAt(gHighLightPos, 1) > 0 then
  159.       if getAt(gNbItem, 2) > 6 then
  160.         set the visible of sprite 45 to 0
  161.       end if
  162.       if getAt(gHighLightPos, 2) > 0 then
  163.         if getAt(gNbItem, 3) > 6 then
  164.           set the visible of sprite 46 to 0
  165.         end if
  166.       end if
  167.     end if
  168.   end if
  169.   if getAt(gHighLightPos, 3) > 0 then
  170.     ActiveButton(2)
  171.   else
  172.     ActiveButton(1)
  173.   end if
  174.   cursor(-1)
  175. end
  176.  
  177. on CloseIndex
  178.   gTermObj(mdispose)
  179.   gIdxTermObj(mdispose)
  180.   set the editableText of sprite 5 to 0
  181.   set the visible of sprite 47 to 1
  182.   set the visible of sprite 48 to 1
  183.   set gLabelLang to gTextLanguage
  184.   if (gRealTextLanguage <> 0) and (gTextLanguage <> gRealTextLanguage) then
  185.     set gTextLanguage to gRealTextLanguage
  186.     set gHighLightPos to [0, 0, 0]
  187.     set gIndexChange to 1
  188.   else
  189.     set gRealTextLanguage to 0
  190.   end if
  191.   set the stretch of sprite 11 to 0
  192.   set the stretch of sprite 18 to 0
  193.   set the stretch of sprite 25 to 0
  194. end
  195.  
  196. on VerifyButtons
  197.   global gCurrentField, gHighLightPos
  198.   if getAt(gHighLightPos, 3) > 0 then
  199.     if the foreColor of cast 10555 = 96 then
  200.       set the foreColor of cast 10555 to 14
  201.       if gCurrentField <> 4 then
  202.         ActiveButton(2)
  203.       end if
  204.       SpriteHandCursor(4)
  205.     end if
  206.   else
  207.     if the foreColor of cast 10555 = 14 then
  208.       set the foreColor of cast 10555 to 96
  209.       ActiveButton(1)
  210.       set the cursor of sprite 4 to -1
  211.     end if
  212.   end if
  213. end
  214.  
  215. on KeyDownIndex
  216.   if (gCurrentField < 4) and (gCurrentField > 0) then
  217.     set NbElement to getAt(gNbItem, gCurrentField)
  218.     set HighL to getAt(gHighLightPos, gCurrentField)
  219.     set CurrentP to getAt(gCurrentPos, gCurrentField)
  220.   end if
  221.   if the keyCode = 125 then
  222.     if (gCurrentField = 1) and not ((HighL = NbElement) and (CurrentP = (NbElement - min(NbElement - 1, 5)))) then
  223.       SetWindow1(1, 6)
  224.       repeat while the shiftDown
  225.         SetWindow1(1, 6)
  226.       end repeat
  227.       SetWindow1(2, 1)
  228.       FindTerms(getAt(gHighLightPos, 1))
  229.       setAt(gCurrentPos, 2, 1)
  230.       setAt(gHighLightPos, 2, 0)
  231.       SetWindow1(2, 3)
  232.     else
  233.       if (gCurrentField = 2) and not ((HighL = NbElement) and (CurrentP = (NbElement - min(NbElement - 1, 5)))) then
  234.         SetWindow1(2, 6)
  235.         repeat while the shiftDown
  236.           SetWindow1(2, 6)
  237.         end repeat
  238.         FindPics(getAt(gHighLightPos, 2))
  239.         setAt(gCurrentPos, 3, 1)
  240.         setAt(gHighLightPos, 3, 0)
  241.         SetWindow1(3, 3)
  242.       else
  243.         if (gCurrentField = 3) and not ((HighL = NbElement) and (CurrentP = (NbElement - min(NbElement - 1, 5)))) then
  244.           SetWindow1(3, 6)
  245.         end if
  246.       end if
  247.     end if
  248.     dontPassEvent()
  249.     abort()
  250.   end if
  251.   if the keyCode = 126 then
  252.     if (gCurrentField = 1) and not ((HighL = 1) and (CurrentP = 1)) then
  253.       SetWindow1(1, 5)
  254.       repeat while the shiftDown
  255.         SetWindow1(1, 5)
  256.       end repeat
  257.       SetWindow1(2, 1)
  258.       FindTerms(getAt(gHighLightPos, 1))
  259.       setAt(gCurrentPos, 2, 1)
  260.       setAt(gHighLightPos, 2, 0)
  261.       SetWindow1(2, 3)
  262.     else
  263.       if (gCurrentField = 2) and not ((HighL = 1) and (CurrentP = 1)) then
  264.         SetWindow1(2, 5)
  265.         repeat while the shiftDown
  266.           SetWindow1(2, 5)
  267.         end repeat
  268.         FindPics(getAt(gHighLightPos, 2))
  269.         setAt(gCurrentPos, 3, 1)
  270.         setAt(gHighLightPos, 3, 0)
  271.         SetWindow1(3, 3)
  272.       else
  273.         if (gCurrentField = 3) and not ((HighL = 1) and (CurrentP = 1)) then
  274.           SetWindow1(3, 5)
  275.         end if
  276.       end if
  277.     end if
  278.     dontPassEvent()
  279.     abort()
  280.   end if
  281.   if the keyCode = 115 then
  282.     if (gCurrentField = 1) and not ((HighL = 1) and (CurrentP = 1)) then
  283.       setAt(gCurrentPos, 1, 1)
  284.       setAt(gHighLightPos, 1, 1)
  285.       SetWindow1(1, 3)
  286.       SetWindow1(2, 1)
  287.       set ListResult to field 10096
  288.       set the text of cast 10095 to line 1 of ListResult
  289.       set the selEnd to the length of line 1 of ListResult
  290.       set the selStart to the selEnd
  291.       set the foreColor of cast 10095 to 14
  292.       FindTerms(getAt(gHighLightPos, 1))
  293.       setAt(gCurrentPos, 2, 1)
  294.       setAt(gHighLightPos, 2, 0)
  295.       SetWindow1(2, 3)
  296.     else
  297.       if (gCurrentField = 2) and not ((HighL = 1) and (CurrentP = 1)) then
  298.         setAt(gCurrentPos, 2, 1)
  299.         setAt(gHighLightPos, 2, 1)
  300.         SetWindow1(2, 3)
  301.         FindPics(1)
  302.         setAt(gCurrentPos, 3, 1)
  303.         setAt(gHighLightPos, 3, 0)
  304.         SetWindow1(3, 3)
  305.       else
  306.         if (gCurrentField = 3) and not ((HighL = 1) and (CurrentP = 1)) then
  307.           setAt(gCurrentPos, 3, 1)
  308.           setAt(gHighLightPos, 3, 1)
  309.           SetWindow1(3, 3)
  310.         end if
  311.       end if
  312.     end if
  313.     dontPassEvent()
  314.     abort()
  315.   end if
  316.   if the keyCode = 119 then
  317.     if (gCurrentField = 1) and not ((HighL = NbElement) and (CurrentP = (NbElement - min(NbElement - 1, 5)))) then
  318.       setAt(gCurrentPos, 1, getAt(gNbItem, 1) - 5)
  319.       setAt(gHighLightPos, 1, getAt(gNbItem, 1))
  320.       SetWindow1(1, 3)
  321.       SetWindow1(2, 1)
  322.       set ListResult to field 10096
  323.       set the text of cast 10095 to line 6 of ListResult
  324.       set the selEnd to the length of line 6 of ListResult
  325.       set the selStart to the selEnd
  326.       set the foreColor of cast 10095 to 14
  327.       FindTerms(getAt(gHighLightPos, 1))
  328.       setAt(gCurrentPos, 2, 1)
  329.       setAt(gHighLightPos, 2, 0)
  330.       SetWindow1(2, 3)
  331.     else
  332.       if (gCurrentField = 2) and not ((HighL = NbElement) and (CurrentP = (NbElement - min(NbElement - 1, 5)))) then
  333.         if getAt(gNbItem, 2) < 6 then
  334.           setAt(gCurrentPos, 2, 1)
  335.         else
  336.           setAt(gCurrentPos, 2, getAt(gNbItem, 2) - 5)
  337.         end if
  338.         setAt(gHighLightPos, 2, getAt(gNbItem, 2))
  339.         SetWindow1(2, 3)
  340.         FindPics(getAt(gHighLightPos, 2))
  341.         setAt(gCurrentPos, 3, 1)
  342.         setAt(gHighLightPos, 3, 0)
  343.         SetWindow1(3, 3)
  344.       else
  345.         if (gCurrentField = 3) and not ((HighL = NbElement) and (CurrentP = (NbElement - min(NbElement - 1, 5)))) then
  346.           if getAt(gNbItem, 3) < 6 then
  347.             setAt(gCurrentPos, 3, 1)
  348.           else
  349.             setAt(gCurrentPos, 3, getAt(gNbItem, 3) - 5)
  350.           end if
  351.           setAt(gHighLightPos, 3, getAt(gNbItem, 3))
  352.           SetWindow1(3, 3)
  353.         end if
  354.       end if
  355.     end if
  356.     dontPassEvent()
  357.     abort()
  358.   end if
  359.   if the keyCode = 116 then
  360.     if (gCurrentField = 1) and not ((HighL = 1) and (CurrentP = 1)) then
  361.       SetWindow2(1, 12)
  362.       repeat while the shiftDown
  363.         SetWindow2(1, 12)
  364.       end repeat
  365.       SetWindow1(2, 1)
  366.       FindTerms(getAt(gHighLightPos, 1))
  367.       setAt(gCurrentPos, 2, 1)
  368.       setAt(gHighLightPos, 2, 0)
  369.       SetWindow1(2, 3)
  370.     else
  371.       if (gCurrentField = 2) and not ((HighL = 1) and (CurrentP = 1)) then
  372.         SetWindow2(2, 12)
  373.         repeat while the shiftDown
  374.           SetWindow2(2, 12)
  375.         end repeat
  376.         FindPics(getAt(gHighLightPos, 2))
  377.         setAt(gCurrentPos, 3, 1)
  378.         setAt(gHighLightPos, 3, 0)
  379.         SetWindow1(3, 3)
  380.       else
  381.         if (gCurrentField = 3) and not ((HighL = 1) and (CurrentP = 1)) then
  382.           SetWindow2(3, 12)
  383.           repeat while the shiftDown
  384.             SetWindow2(3, 12)
  385.           end repeat
  386.         end if
  387.       end if
  388.     end if
  389.     dontPassEvent()
  390.     abort()
  391.   end if
  392.   if the keyCode = 121 then
  393.     if (gCurrentField = 1) and not ((HighL = NbElement) and (CurrentP = (NbElement - min(NbElement - 1, 5)))) then
  394.       SetWindow2(1, 13)
  395.       repeat while the shiftDown
  396.         SetWindow2(1, 13)
  397.       end repeat
  398.       SetWindow1(2, 1)
  399.       FindTerms(getAt(gHighLightPos, 1))
  400.       setAt(gCurrentPos, 2, 1)
  401.       setAt(gHighLightPos, 2, 0)
  402.       SetWindow1(2, 3)
  403.     else
  404.       if (gCurrentField = 2) and not ((HighL = NbElement) and (CurrentP = (NbElement - min(NbElement - 1, 5)))) then
  405.         SetWindow2(2, 13)
  406.         repeat while the shiftDown
  407.           SetWindow2(2, 13)
  408.         end repeat
  409.         FindPics(getAt(gHighLightPos, 2))
  410.         setAt(gCurrentPos, 3, 1)
  411.         setAt(gHighLightPos, 3, 0)
  412.         SetWindow1(3, 3)
  413.       else
  414.         if (gCurrentField = 3) and not ((HighL = NbElement) and (CurrentP = (NbElement - min(NbElement - 1, 5)))) then
  415.           SetWindow2(3, 13)
  416.           repeat while the shiftDown
  417.             SetWindow2(3, 13)
  418.           end repeat
  419.         end if
  420.       end if
  421.     end if
  422.     dontPassEvent()
  423.     abort()
  424.   end if
  425.   if the key = " " then
  426.     dontPassEvent()
  427.     abort()
  428.   end if
  429.   if (the keyCode = 123) or (the keyCode = 124) then
  430.     return 
  431.   end if
  432.   if the machineType <> 256 then
  433.     KeyTest_Mac()
  434.   else
  435.     KeyTest_PC()
  436.   end if
  437. end
  438.